package io.bdmc.modules.sys.controller;

import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import io.bdmc.common.utils.MyMap;
import io.bdmc.common.utils.MyPage;
import io.bdmc.common.utils.R;
import io.bdmc.modules.sys.entity.SysLog;
import io.bdmc.modules.sys.service.SysLogService;


/**
 * 系统日志
 * 
 * @author huang lu
 * @email hlkyo@qq.com
 * @date 2017-03-08 10:40:56
 */
@Controller
@RequestMapping("/sys/log")
public class SysLogController {
	@Autowired
	private SysLogService logService;
	
	/**
	 * 列表
	 */
	@ResponseBody
	@RequestMapping("/list")
	@RequiresPermissions("sys:log:list")
	public R list(@RequestParam Map<String, String> params){
		//查询列表数据
		Long current =Long.valueOf(params.get("current"));
		Long size = Long.valueOf(params.get("size"));
		String key = params.get("key");
		MyPage<SysLog> myPage = new MyPage<SysLog>(current,size);
        MyPage<SysLog> map = logService.queryList(myPage,key);
		return R.ok().putData(MyMap.ok(map.getRecords(), map.getTotal()));
	}
	
}
